﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Quanly.Master" AutoEventWireup="true" CodeBehind="Baiviet.aspx.cs" Inherits="BHTT.Baiviet.Baiviet" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register src="~/Baiviet/subview/MenuBaiviet.ascx" tagname="menuBar" tagprefix="uc1" %>
<%@ Register src="~/Baiviet/subview/BaivietForm.ascx" tagname="baivietForm" tagprefix="uc2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <uc1:menuBar runat="server" ID="MenuBarBaiviet"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <script type="text/javascript">
        function themClick() {
            window.location.href = 'subview/Themmoibaiviet.aspx?Loai=' + $get('<%= cboLoaibaiviet.ClientID %>').value;
        }

        function suaClick() {
            window.location.href = 'subview/Suabaiviet.aspx?Loai=' + $get('<%= cboLoaibaiviet.ClientID %>').value;
        }

        function spClick() {
            window.location.href = 'Themsanpham.aspx';
        }
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="grid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="dgrBaiviet"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>            
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <center>
        <div style="width: 100%; height: 50px; background-color: #ff6600; padding-left: 87px;">
            <div style="width: 800px; height: 50px; float:left;">
                <div style="float:left; padding-top: 10px; padding-left: 10px;">
                    Loại bài viết
                    <telerik:RadComboBox ID="cboLoaibaiviet" runat="server"
                        EnableEmbeddedSkins="False" Skin="skinComboBox" Width="200" Height="30" 
                        MaxHeight="200" ForeColor="Black" 
                        AutoPostBack="True"
                        onselectedindexchanged="cboLoaibaiviet_SelectedIndexChanged1">
                        </telerik:RadComboBox>
                </div>
                <div class="imageClick" style="float: left; cursor:pointer;" onclick="themClick()"><img style="border:0px;vertical-align:middle;" alt="" src="../Image/Add.png" />Thêm</div>
                <div class="imageClick" style="float: left; cursor:pointer;" onclick="suaClick()"><img style="border:0px;vertical-align:middle;" alt="" src="../Image/edit.png" />Sửa</div>
                <div style="float: left; cursor:pointer;"><img style="border:0px;vertical-align:middle;" alt="" src="../Image/delete.png" />Xóa</div>
                <div style="float: left; cursor:pointer;"><img style="border:0px;vertical-align:middle;" alt="" src="../Image/refresh.png" />Làm mới dữ liệu</div>
            </div>
            <div id="divSanpham" style="margin-left:150px; width: 150px; height: 50px; padding-top:15px; cursor:pointer; font-weight:bold;" onclick="spClick()">
                <!--<ul class="topnav">
                    <li>
                        <a href="#">Danh mục</a>
                        <ul id="subnav">
                            <li><a href="#">Kho cấp 1</a></li>
                            <li><a href="#">Kho cấp 2</a></li>
                            <li><a href="#">Sản phẩm</a></li>
                            <li><a href="#">Nhập kho</a></li>
                            <li><a href="#">Xuất kho</a></li>
                        </ul>
                    </li>
                </ul>-->
                Sản phẩm
            </div>
        </div>
    </center>
    <div id="divDulieu" style="position:absolute;">
        <telerik:RadGrid ID="dgrBaiviet" AllowAutomaticUpdates="True" AllowAutomaticDeletes="True"
            AllowSorting="True" AllowPaging="True" GridLines="None" runat="server" ShowFooter="True" 
            AllowMultiRowSelection="True" PageSize="7" AllowMultiRowEdit="True" AllowAutomaticInserts="True" 
            OnItemCreated="RadGrid_ItemCreated" OnItemDeleted="RadGrid_ItemDeleted" ena
            OnItemUpdated="RadGrid_ItemUpdated" OnItemInserted="RadGrid_ItemInserted"
            ForeColor="Black" Height="100%" Width="100%" AllowFilteringByColumn="True" 
            Font-Size="12pt">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView Width="100%" CommandItemDisplay="Top" ClientDataKeyNames="ID"
                            DataKeyNames="ID" AutoGenerateColumns="False" >
                <EditFormSettings>
                    <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                </EditFormSettings>
                <CommandItemTemplate></CommandItemTemplate>
                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="Ảnh đại diện">
                        <ItemTemplate>
                            <img src="<%# Eval("anhdaidien") %>" height="100" width="100" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="tenbaiviet" HeaderText="Tên bài viết" SortExpression="tenbaiviet"/>
                    <telerik:GridBoundColumn DataField="shortcut" HeaderText="Mở đầu" />
                </Columns>
            </MasterTableView>
            <ClientSettings>
                <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />
                 <ClientEvents OnRowSelected="RowSelected" />
            </ClientSettings>
            <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>
    </div>

    <div id="element_to_pop_up" style="float: left; padding-left: 100px; padding-right: 100px;">
        <telerik:RadEditor ID="RadEditor1" runat="server" >
        <ImageManager ViewPaths="~/Image"
                                UploadPaths="~/Image"
                                DeletePaths="~/Image">
                            </ImageManager>
    </telerik:RadEditor>
    </div>
</asp:Content>
